Pay for presale with PayPal
The paypalForPresale
mutation allows a user to create a PayPal checkout order for a presale order. The frontend (FE) will be redirected to the PayPal checkout page.
Mutation: paypalForPresale
Schema:
paypalForPresale(
presaleId: Int!,
orderId: Int!,
currencyCode: String!
): OrderResponseDTO
Parameters
presaleId
(Int): The ID of the presale. This field is mandatory.orderId
(Int): The ID of the order to pay for. This field is mandatory.currencyCode
(String): The currency code for the payment (e.g., "USD"). This field is mandatory.
Return
The mutation returns an OrderResponseDTO
object which contains the necessary information to redirect to the PayPal checkout page.
Example Mutation
The following is an example of how to use the paypalForPresale
mutation to create a PayPal checkout order for a presale order:
mutation {
paypalForPresale(
presaleId: 1,
orderId: 123,
currencyCode: "USD"
) {
orderId,
redirectUrl
}
}
Note
- The frontend will be redirected to the PayPal checkout page using the URL provided in the
OrderResponseDTO
.
In this example, the mutation initiates a PayPal payment for the presale order with ID 123
in the presale with ID 1
. The payment will be made in USD. The return value includes the OrderResponseDTO
details such as orderId
and redirectUrl
, which can be used to redirect the user to the PayPal checkout page.